import AbstractComponent from "../base/AbstractComponent";
import AbstractController from "../base/AbstractController";
import { Singleton } from "../common/Common";
import { GameBaseLogic } from "./billiards/GameBaseLogic";
import { GameManage } from "./billiards/GameManage";
import { GameModel } from "./billiards/model/GameModel";

export class Model
 extends Singleton<Model>{
    constructor() {
        super();
    }

    public init(...args: any[]): void {

    }
    
    private _gameController:AbstractController;
    public set gameController(v:AbstractController)
    {
        this._gameController = v;
    }

    public get gameController():AbstractController
    {
        return this._gameController;
    }

    // 场景脚本
    private _gameView: AbstractComponent;
    public set gameView(v:  AbstractComponent)
    {
        this._gameView = v;
    }
    public get gameView():  AbstractComponent
    {
        return this._gameView;
    }

    // 场景逻辑脚本
    private _gameLogic: GameBaseLogic;
    public set gameLogic(v:  GameBaseLogic)
    {
        this._gameLogic = v;
    }
    public get gameLogic():  GameBaseLogic
    {
        return this._gameLogic;
    }

    /* 清理数据 */
    public clear() {
        this._gameController = null
        this._gameView = null
        this._gameLogic = null
    }
    
    public get gameManage(): GameManage { return GameManage.getInstance() };
    public get gameModel(): GameModel { return GameModel.getInstance<GameModel>(GameModel) };
    public get gameModel3(): GameModel { return GameModel.getInstance<GameModel>(GameModel) };

}